<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>北京医院</title>
<script type="text/javascript">
function yanzheng(){
	var name=document.getElementById(uname).value;
	var dname=document.getElementById(dname);
	var reg=/^[a-zA-Z][a-zA-Z0-9_]{4,15}$/;
	if(name==""){
		dname.innerHTML="用户名不能为空";
	}else if(name!=reg){
		dname.innerHTML="用户名格式不正确";
	}else{
		dname.innerHTML="";
	}
	
	
	var pawd=document.getElementById(upawd).value;
	var dpawd=document.getElementById(dpawd);
	var regs=/^[a-zA-Z]w{5,17}$/;	
	if(pawd==""){
		dpawd.innerHTML="密码不能为空";		
	}else if(pawd!=regs){
		dpawd.innerHTML="密码格式不正确";
	}else{
		dpawd.innerHTML="";
	}
	
	if(document.getElementById(upawd1).value!=document.getElementById(upawd).value){
		dpawd1.innerHTML="密码不一致";			
	}else{
		dpawd1.innerHTML="";	
	}
	
	var zname=document.getElementById(zname).value;
	var dzname=document.getElementById(dznam);
	if(zname==""){
		dzname.innerHTML="姓名不能为空";
	}else{
		dzname.innerHTML="";
	}
	
	
	
	var phone=document.getElementById(uphone).value;
	var dphone=document.getElementById(dphone);
	var rege=/^d{3}-d{8}|d{4}-d{7}$/;
	var reges=/^d{11}$/;
	if(phone==""){
		dphone.innerHTML="电话不能为空";		
	}else if(phone!=rege || phone!=reges){
		dphone.innerHTML="格式不正确";
	}else{
		dphone.innerHTML="";	
	}
	
	
	var uid=document.getElementById(uid).value;
	var duid=document.getElementById(duid);
	var regid=/^d{15}|d{}18$/;
	if(uid==""){
		duid.innerHTML="身份证号码不能为空";
	}else if(uid!=regid){
		duid.innerHTML="格式不正确";
	}else{
		duid.innerHTML="";	
	}
	
	
	
	
	
	
	
	
	
	var uemail=document.getElementById(uemail).value;
	var demail=document.getElementById(demail);
	var regem=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if(uemail==""){
		demail.innerHTML="邮箱不能为空";
	}else if(uemail!=regem){
		demail.innerHTML="邮箱格式不正确";
	}else{
		demail.innerHTML="";	
	}
}
</script>
</head>
<body>
<h4>新用户注册</h4>
<form action="zhuceAction" method="post" onSubmit="return yanzheng()">
<table width="654">
<tr>
<td width="80" >用户名</td>
<td width="173"><input type="text" name="user.username" id="uname" onMouseOut="yanzheng()"></td>
<td width="312" ><div id="dname" style=" font-size:12px">字母开头，允许5-16字节，允许字母数字下划线</div>
</td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="user.password" id="upawd" onMouseOut="yanzheng()"></td>
<td><div id="dpawd" style="font-size:12px">以字母开头，长度在6-18之间，只能包含字符、数字和下划线。</div></td>

</tr>
<tr>
<td>验证密码</td>
<td><input type="password" name="user.password" id="upawd1" onMouseOut="yanzheng()"></td>
<td><div id="dpawd1" style="font-size:12px"></div></td>

</tr>
<tr>
<td>真实姓名</td>
<td><input type="text" name="user.xingming" id="zname" onMouseOut="yanzheng()"></td>
<td><div id="dzname" style="font-size:12px"></div></td>
</tr>
<tr>
<td>电话</td>
<td><input type="text" name="user.phone" id="uphone" onMouseOut="yanzheng()"></td>
<td><div id="dphone" style="font-size:12px"></div></td>
</tr>
<tr>
<td>身份证号码</td>
<td><input type="text" name="user.identity" id="uid" onMouseOut="yanzheng()"></td>
<td><div id="duid" style="font-size:12px"></div></td>
</tr>
<tr>
<td>E_mail</td>
<td><input type="text" name="user.email" id="uemail" onMouseOut="yanzheng()"></td>
<td><div id="demail" style="font-size:12px"></div></td>
</tr>


<tr>
<td></td>
<td><input type="submit" value="注册" onClick="yanzheng()"></td>
<td></td>
</tr>


</table>

</form>
</body>
</html>